# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=checkbashisms
pkgver=2.22.1
pkgrel=0
pkgdesc="Check shell scripts for POXIX compliance"
url="https://tracker.debian.org/pkg/devscripts"
arch="noarch"
license="GPL-2.0-or-later"
depends="perl"
subpackages="$pkgname-doc $pkgname-bash-completion"
source="https://ftp.debian.org/debian/pool/main/d/devscripts/devscripts_$pkgver.tar.xz"
builddir="$srcdir/devscripts-$pkgver/scripts"

check() {
	printf '#!/bin/sh\necho "hello world"\n' > ./testfile
	perl ./checkbashisms --version
	perl ./checkbashisms ./testfile
}

prepare() {
	default_prepare
	mv "$pkgname".pl "$pkgname"
	sed -i "s/###VERSION###/$pkgver/" "$pkgname"
}

package() {
	install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
	install -Dm644 "$pkgname".1 \
		"$pkgdir/usr/share/man/man1/$pkgname".1
	install -Dm644 "$pkgname".bash_completion \
		$pkgdir/usr/share/bash-completion/completions/"$pkgname"
}

sha512sums="
260603e1a655035c5aca3c9734db1bc6aa7e9aa017ece7e9158c57e06a1ee548922ec2defdd9dcb4560743d78aef08d30695b1bc833bd4d77fe1c7497d157c45  devscripts_2.22.1.tar.xz
"
